package com.maxh.service.impl;

import com.maxh.mapper.LoginMapper;
import com.maxh.pojo.Admin;
import com.maxh.pojo.Teacher;
import com.maxh.pojo.User;
import com.maxh.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("LoginService")
public class LoginServiceImpl implements LoginService {
    @Autowired(required =  false)
    LoginMapper loginMapper;

    @Override
    public Admin findByUserNum(String userNum) {
        return loginMapper.findByUserNum(userNum);
    }

    @Override
    public Teacher findByTeacherNum(String userNum) {
        return loginMapper.findByTeacherNum(userNum);
    }

    @Override
    public User findByStudentNum(String userNum) {
        return loginMapper.findByStudent(userNum);
    }

    @Override
    public Admin findAdminById(String adminId) {
        return loginMapper.findAdminById(adminId);
    }

    @Override
    public Teacher findTeacherById(String teacherId) {
        return loginMapper.findTeacherById(teacherId);
    }

    @Override
    public User findUserById(String userId) {
        return loginMapper.findUserById(userId);
    }

    @Override
    public Boolean updateAdminPassword(String adminId, String password) {
        return loginMapper.updateAdminPassword(adminId,password);
    }

    @Override
    public Boolean updateUserPassword(String userId, String newPassword) {
        return loginMapper.updateUserPassword(userId,newPassword);
    }

}
